#include "PhysicalLayer.h"
void PhysicalLayer::Exec(string s) {
	if (s == "UP") {
	}
	else if (s == "DOWN") {
		bit jug;
		jug.value = 0;
		cout << "      Message start sending: " << endl;
		cout << "        ";
		for (int i = 1; i <= data.size(); i++) {
			if (jug.value == data[i-1].value) {
				cout <<0 ;
			}
			else {
				cout << 1;
			}
			if (i % 71 == 0 ) {
				cout << endl;
				cout << "        ";
			}
		}
		cout << endl;
		cout << "      Message sent successfully!"<< endl;
	}
}

vector<bit> PhysicalLayer::Send() {
	return data;
}

void PhysicalLayer::Recv(vector<bit> b) {
	data = b;
}

void PhysicalLayer::SayHello() {
	cout << "Hi, This is PhysicalLayer" << endl;
}

int PhysicalLayer::len() {
	return data.size();
}